//
//  UpdateViewController.swift
//  daily_count
//
//  Created by 段帅 on 2018/7/4.
//  Copyright © 2018年 Sooc. All rights reserved.
//

import UIKit

class UpdateViewController: UIViewController {

    
    
    @IBOutlet weak var name_text: UITextField!
    
    @IBOutlet weak var phone_text: UITextField!
    
    
    @IBOutlet weak var age_text: UITextField!
    
    @IBAction func send(_ sender: Any) {
        
        
        if (name_text.hasText||phone_text.hasText||age_text.hasText) {
            DSToolManager.postWithToken(URLString: severseUrl+api_update, parameters: ["name":name_text.text as AnyObject,"phone":phone_text.text as AnyObject,"age":age_text.text as AnyObject], completed: { (data, isSucess) in
                if isSucess {
                    DSToolManager.alertSucess(message: "修改成功");
                    DSToolManager.delay(1.5, task: { 
                        self.navigationController?.popViewController(animated: true); 
                    });
                }else {
                    DSToolManager.alertFaild(message: data!["statusCode"] as! String);
                }
            })
        }else{
            DSToolManager.alertFaild(message: "请填写信息后提交")
        }
        
        
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
